package com.lmaye.lr.common.exception;

import com.lmaye.lr.common.result.ResultCode;

/**
 * -- 通用异常
 *
 * @author lmay.Zhou
 * @date 2018/12/5 15:25 星期三
 * @qq 379839355
 * @email lmay@lmaye.com
 */
public class CommonException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    /**
     * 响应编码
     */
    private ResultCode resultCode;

    public CommonException(ResultCode resultCode) {
        super(resultCode.getPropKey());
        this.resultCode = resultCode;
    }

    public CommonException(ResultCode resultCode, Throwable cause) {
        super(resultCode.getPropKey(), cause);
        this.resultCode = resultCode;
    }

    /**
     * 获取错误信息
     *
     * @return ResultCode
     */
    public ResultCode getResultCode() {
        return resultCode;
    }
}
